﻿--更新表结构
/*
alter table T_Phone add SalePoint varchar(8000)
*/

--更新视图
/*
alter VIEW [dbo].[View_T_Phone]
AS
	SELECT dbo.T_Phone.*,
		dbo.T_Supplier.SupplierName,
		dbo.T_Supplier.SupplierCode,
		AllPhoneTypeName=(select [dbo].[Fun_GetAllPhoneTypeName](dbo.T_Phone.PhoneId)),
		TopPictureSrc=(select top 1 Src from T_PhonePicture where dbo.T_PhonePicture.PhoneId=dbo.T_Phone.PhoneId order by IsTop desc),
		ScreenName=Screen.ClassificationName,
		ChipName=Chip.ClassificationName,
		SeriesName=Series.ClassificationName
	FROM dbo.T_Phone
	left outer join dbo.T_Supplier on dbo.T_Supplier.SupplierId=dbo.T_Phone.SupplierId
	left outer join dbo.T_Classification as Screen 
		on Screen.ParentId in (select ClassificationId from dbo.T_Classification where ClassificationCode='Screen')
		and Screen.ClassificationId=dbo.T_Phone.ScreenId
	left outer join dbo.T_Classification as Chip 
		on Chip.ParentId in (select ClassificationId from dbo.T_Classification where ClassificationCode='Chip')
		and Chip.ClassificationId=dbo.T_Phone.ChipId
	left outer join dbo.T_Classification as Series 
		on Series.ParentId in (select ClassificationId from dbo.T_Classification where ClassificationCode='Series')
		and Series.ClassificationId=dbo.T_Phone.SeriesId
*/